home *** CD-ROM | disk | FTP | other *** search
/ Megahits 5 / Megahits 5 (1994)(GTI - Rhein-Main-Soft)(DE)(Disc 2 of 2)[!].iso / archive / print / hwgpostbeta2.lha / HWGPOST / postlib.h < prev    next >
C/C++ Source or Header  |  1994-06-03  |  9KB  |  255 lines

  1. #ifndef POSTLIB_H
  2. #define POSTLIB_H
  3. /*------------------------------------------------------------------------*/
  4. /*                                                                        *
  5.  *  $Id: postlib.h,v 2.12 1994/05/20 19:13:56 heinz Exp $
  6.  *                                                                        */
  7. /*------------------------------------------------------------------------*/
  8.  
  9. /*------------------------------------------------------------------------*/
  10.  
  11. /* PostScript interpreter file "postlib.h" - library interface header (Amiga)
  12.  *
  13.  * Based on postlib.h 1.7, (C) Adrian Aylward 1989, 1991.
  14.  *
  15.  * This file defines the library interface, so that other programs can
  16.  * use the PostScript drawing machinery.  It is totally Amiga specific.
  17.  *
  18.  * All versions >=2.0 ©1993,1994 HWG, For Joan Thuesen.
  19.  *
  20.  * HWGPOST leans heavily towards PostScript Level 2
  21.  *
  22.  * All rights reserved. Commercial use of HWGPOST only with my permission!
  23.  * Read the docs for further information on legal issues.
  24.  * Don't use HWGPOST without reading up on the legal issues!
  25.  *
  26.  *
  27.  *  Heinz Wrobel
  28.  *  Karlstr. 16
  29.  *  82131 Gauting
  30.  *  Germany
  31.  *  FAX +49 89 850 51 25 (I don't like phone calls)
  32.  *  <heinz@hwg.muc.de>
  33.  *
  34.  */
  35.  
  36.  
  37. #include <exec/types.h>
  38. #include <dos/dos.h>
  39.  
  40. /*------------------------------------------------------------------------*/
  41. /* Default and minimum memory sizes */
  42.  
  43. #define defmemflen  60000
  44. #define defmemhlen  20000
  45. #define defmemvlen  50000
  46. #define defmemllen  10000
  47. #define defmemplen  60000
  48. #define minmemflen   5000
  49. #define minmemhlen   1000
  50. #define minmemvlen   5000
  51. #define minmemllen   1000
  52. #define minmemplen   5000
  53.  
  54. /*------------------------------------------------------------------------*/
  55. /* The device page and parameter block */
  56.  
  57. /*
  58.  **************************************************************************
  59.  *** IMPORTANT NOTE: For anything below, the General Amiga Development  ***
  60.  ***                 Guidelines as described in the Addison Wesley "ROM ***
  61.  ***                 Kernel Reference Manual Libraries" are valid.      ***
  62.  ***                                                                    ***
  63.  ***                 Note especially that "Fields that are not defined  ***
  64.  ***                 to contain particular initial values must be       ***
  65.  ***                 initialized to zero. This includes pointer         ***
  66.  ***                 fields." and "All reserved or unused fields must   ***
  67.  ***                 be initialized to zero for future compatibility."  ***
  68.  **************************************************************************
  69. */
  70.  
  71. /* A possible extension to the device structure described below */
  72. struct PSextdevice
  73. {
  74.     unsigned long       flags;
  75.  
  76.     unsigned char       *maskbuf;
  77.  
  78.     /* The length of this structure is subject to change. */
  79.     long                reserved2[10];   /* Avoid recompilation */
  80.  
  81. };
  82.  
  83. /* The standard device structure */
  84. struct PSdevice
  85. {
  86.     /*---------------------------------------------------------------------
  87.        "buf"            These are 24 bitplane pointers which can be set or
  88.                         cleared. HWGPOST will just ignore NULL pointers to
  89.                         make masking possible.
  90.  
  91.        "len"            This value gives the total length in bytes of the
  92.                         memory for one bitplane.
  93.  
  94.        "depth"          How many bitplanes should be used at all.
  95.  
  96.        "flags"          Various. See below.
  97.  
  98.        "bitspercolor"   To specify how many bitplanes are used per color,
  99.                         you set "bitspercolor" to the appropriate value. If
  100.                         this value is not set, one bitplane per color is
  101.                         assumed.
  102.  
  103.                         Example: RGB 3:3:2 => depth=8, bitspercolor=3
  104.  
  105.        "PSextdevice"    Set it for the special features or leave it NULL.
  106.  
  107.        "xoff", "yoff"   To specify rendering offsets into the bitplanes.
  108.  
  109.        "xbytes"         The size of one row in a bitplane in bytes.
  110.  
  111.        "xsize", "ysize" The size of the bitplane in pixels.
  112.  
  113.        "ybase"          The first row to draw into for band rendering.
  114.  
  115.        "yheight"        The number of rows to use for band rendering.
  116.  
  117.        "xden", "yden"   The dpi values to use.
  118.  
  119.        "ydir"           Direction of the y axis for rendering.
  120.  
  121.  
  122.        Fields in the extended device structure:
  123.  
  124.        "flags"          See below.
  125.  
  126.        "maskbuf"        If set, must be a plane as in "buf". For any
  127.                         rendering you'll get bits set in this mask plane.
  128.                         This gives you a mask of the actually used places
  129.                         in the buffer. The mask might be useful for
  130.                         BltMaskBitMapRastPort() or some such. erasepage
  131.                         will clear this mask plane.
  132.  
  133.       ---------------------------------------------------------------------
  134.     */
  135.  
  136.     unsigned char       *buf[24];
  137.     int                 len;
  138.     short               depth;
  139.     unsigned char       flags;
  140.     unsigned char       bitspercolor;
  141.     struct PSextdevice  *PSextdevice;
  142.     short               xoff, yoff;
  143.     short               xbytes, xsize, ysize;
  144.     short               ybase, yheight;
  145.     short               xden, yden;
  146.     short               ydir;
  147. };
  148.  
  149. /* Definitions for the flags field in the standard device structure */
  150. #define HWGPOST_DEVB_NOSHADE           0    /* Suppress any halftoning */
  151. #define HWGPOST_DEVF_NOSHADE        0x01
  152. #define HWGPOST_DEVB_CMYK              1    /* CMYK instead of RGBW */
  153. #define HWGPOST_DEVF_CMYK           0x02
  154.  
  155. /* Currently there are no flags defined for the extended device structure */
  156.  
  157. /*------------------------------------------------------------------------*/
  158. /* The parameter block */
  159.  
  160. struct PSparm
  161. {
  162.     struct PSdevice page;
  163.     int             memvlen, memflen, memllen, memhlen;
  164.     APTR            userdata, flushfunc, copyfunc;
  165.     BPTR            infh, outfh, errfh;
  166.     long            reserved[4];
  167. };
  168.  
  169. /*------------------------------------------------------------------------*/
  170. /* Errors */
  171.  
  172. #define errdictfull             1
  173. #define errdictstackoverflow    2
  174. #define errdictstackunderflow   3
  175. #define errexecstackoverflow    4
  176. #define errinterrupt            5
  177. #define errinvalidaccess        6
  178. #define errinvalidexit          7
  179. #define errinvalidfileaccess    8
  180. #define errinvalidfont          9
  181. #define errinvalidrestore      10
  182. #define errinvalidstop         11
  183. #define errioerror             12
  184. #define errlimitcheck          13
  185. #define errnocurrentpoint      14
  186. #define errrangecheck          15
  187. #define errstackoverflow       16
  188. #define errstackunderflow      17
  189. #define errsyntaxerror         18
  190. #define errtimeout             19
  191. #define errtypecheck           20
  192. #define errundefined           21
  193. #define errundefinedfilename   22
  194. #define errundefinedresult     23
  195. #define errunmatchedmark       24
  196. #define errunregistered        25
  197. #define errVMerror             26
  198. #define errmemoryallocation    27
  199. #define errkill                28
  200. #define errconfiguration       29
  201. #define errundefinedresource   30
  202. #define errmax                 31
  203.  
  204. /*------------------------------------------------------------------------*/
  205. /* Flags */
  206.  
  207. #define PSFLAGSTRING  1 /* Interpret string */
  208. #define PSFLAGFILE    2 /* Interpret file */
  209. #define PSFLAGINTER   4 /* Interactive, issue prompts */
  210. #define PSFLAGCLEAR   8 /* Clear stacks afterwards */
  211. #define PSFLAGSAVE   16 /* Save and restore */
  212. #define PSFLAGERASE  32 /* Erase page afterwards */
  213.  
  214. /*------------------------------------------------------------------------*/
  215. /* Flags for PSsignalint() */
  216.  
  217. #define PSINTSIGB_ABORT              0
  218. #define PSINTSIGB_KILL               1
  219. #define PSINTSIGB_VMRECLAIMLOCAL     2
  220. #define PSINTSIGB_VMRECLAIMALL       3
  221.  
  222. #define PSINTSIGF_ABORT              0x00000001
  223. #define PSINTSIGF_KILL               0x00000002
  224. #define PSINTSIGF_VMRECLAIMLOCAL     0x00000004
  225. #define PSINTSIGF_VMRECLAIMALL       0x00000008
  226.  
  227. /*------------------------------------------------------------------------*/
  228. /* Entry points */
  229.  
  230. extern int      PScreateact(struct PSparm *parm);
  231. extern void     PSdeleteact(int arec);
  232. extern int      PSintstring(int arec, char *string, int length, int flags);
  233. extern void     PSsignalint(int arec, int flag);
  234. extern void     PSsignalfpe(int arec);
  235. extern void     PSerror(int arec, int errnum);
  236. extern void     PSsetdevice(int arec, struct PSdevice *page);
  237. extern char     *PSerrstr(int arec, int errnum);
  238.  
  239. /*------------------------------------------------------------------------*/
  240. #ifdef __SASC
  241. #pragma libcall PSbase PScreateact  1e    901 /* d0 = (a1)*/
  242. #pragma libcall PSbase PSdeleteact  24    801 /*      (a0)*/
  243. #pragma libcall PSbase PSintstring  2A 109804 /* d0 = (a0, a1, d0, d1)*/
  244. #pragma libcall PSbase PSsignalint  30   0802 /*      (a0, d0)*/
  245. #pragma libcall PSbase PSsignalfpe  36    801 /*      (a0)    */
  246. #pragma libcall PSbase PSerror      3C   0802 /*      (a0, d0)*/
  247. #pragma libcall PSbase PSsetdevice  4E   9802 /*      (a0, a1)*/
  248. #pragma libcall PSbase PSerrstr     54   0802 /* d0 = (a0, d0)*/
  249. #endif /* __SASC */
  250.  
  251. /*------------------------------------------------------------------------*/
  252.  
  253. #endif /* POSTLIB_H */
  254.  
  255.